package com.ruoyi.project.lely.controller;


import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.common.R;
import com.ruoyi.framework.web.domain.AjaxResult;
import com.ruoyi.project.lely.bean.dto.LyStatusDTO;
import com.ruoyi.project.lely.bean.entity.LyCollect;
import com.ruoyi.project.lely.bean.entity.LyOrder;
import com.ruoyi.project.lely.service.LyCartService;
import com.ruoyi.project.lely.service.LyCategoryService;
import com.ruoyi.project.lely.service.LyGoodsService;
import com.ruoyi.project.lely.service.LyOrderService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author luoyong
 * @Desc: 菜品管理
 * @since 2022-01-13
 */
@Api(tags = "Mini-菜品管理")
@RestController
@RequestMapping("/mini/goods")
public class GoodsController {

    @Autowired
    private LyGoodsService goodsService;
    @Autowired
    private LyOrderService orderService;

    @ApiOperation("获取订单商品详情")
    @GetMapping(value = {"/getOrderDetail"})
    public R getOrderDetail(
            @RequestParam(defaultValue = "0") Integer showType,
            @RequestParam(defaultValue = "1") Integer page,
            @RequestParam(defaultValue = "10") Integer size){
        return orderService.getOrderDetail(new Page<LyOrder>(page, size),showType);
    }

    @ApiOperation("禁用启用")
    @PostMapping(value = {"/changeStatus1"})
    public R changeStatus(@Validated LyStatusDTO dto) {
        return goodsService.changeStatus(dto);
    }

}

